package com.qdlc.p2p.dal.dto;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.qdlc.p2p.common.constant.Global;

/**
 * RdUserStatistics 用户统计信息
 *
 * @author liya
 * @version 1.1.0.0
 */
@Entity
@Table(name = Global.DB_PREFIX + "user_statistics")
public class UserStatistics {

    /** 主键 */
    @Id
    @Column(name = "id_")
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    /** 用户 */
    @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    @JoinColumn(name = "user_id")
    private User user;

    /** 投资总数 */
    @Column(name = "invest_count")
    private Long investCount;

    /** 借款总数 */
    @Column(name = "borrow_count")
    private Long borrowCount;

    public UserStatistics() {
    }

    public UserStatistics(Long id, User user) {
        this.id = id;
        this.user = user;
    }

    public UserStatistics(Long id, User user, Long investCount,
                          Long borrowCount) {
        this.id = id;
        this.user = user;
        this.investCount = investCount;
        this.borrowCount = borrowCount;
    }

    // Property accessors
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }


    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Long getInvestCount() {
        return this.investCount;
    }

    public void setInvestCount(Long investCount) {
        this.investCount = investCount;
    }

    public Long getBorrowCount() {
        return this.borrowCount;
    }

    public void setBorrowCount(Long borrowCount) {
        this.borrowCount = borrowCount;
    }
}